<template>
    <div class="title-normal" @click="eventClickJumpToUrlPath">
        <h1>{{ title }}</h1>
        <p v-if="tip">{{ tip }}</p>
        <p v-else>&nbsp;</p>
    </div>
</template>

<style lang="scss" scoped>
    .title-normal {
        display: flex;
        justify-content: space-between;
        align-items: center;

        h1 {
            margin: 0rem;
            padding: 0rem;
            font-size: 1.4rem;
            color: #333333;
            padding-left: 1.2rem;
            position: relative;

            &:before {
                content: "";
                display: block;
                position: absolute;
                left: 0rem;
                top: 0rem;
                bottom: 0rem;
                width: 0.3rem;
                background-color: #00CC00;
                border-radius: 0.4rem;
            }
        }

        p {
            margin: 0rem;
            padding: 0rem;
            font-size: 1.3rem;
            color: #999999;
            padding-right: 1rem;
            position: relative;

            &:after {
                content: "";
                display: block;
                width: 1rem;
                position: absolute;
                top: 0rem;
                bottom: 0rem;
                right: 0rem;
                background-image: url('../../../../static/images/arrow-right-ash.png');
                background-repeat: no-repeat;
                background-position: center right;
                background-size: 50% 50%;
            }
        }
    }
</style>

<script>
    export default {
        // route => path | name, data
        props: ['title', 'tip', 'route'],
        methods: {
            eventClickJumpToUrlPath() {
                console.log('route ',this.route)
                if (!this.route) return;
                if (this.route.path) {
                    this.$router.push({
                        path: this.route.path,
                        query: this.route.data || {}
                    });
                } else if (this.route.name) {
                    this.$router.push({
                        name: this.route.name,
                        params: this.route.data || {}
                    });
                }
            }
        }
    }
</script>
